#include "TelefoneArthur.h"
#include <GL/glu.h>
#include "gllib/Objects.h"

static void desenhaBase()
{
    GLfloat cor[] = {0.6, 0.4, 0.4, 1.0};
    glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, cor);
//	glColor3f(0.6,0.4,0.4);
	gllibEightDots(
						-6,0,6,6,0,6,6,0,2,-6,0,2,
						-6,3,6,6,3,6,6,3,2,-6,3,2);

	gllibEightDots(
						-6,0,-2,6,0,-2,6,0,-6,-6,0,-6,
						-6,3,-2,6,3,-2,6,3,-6,-6,3,-6);

	gllibEightDots(
						-6,0,2,-3,0,2,-2,0,-2,-6,0,-2,
						-6,3,2,-3,3,2,-2,3,-2,-6,3,-2);

	gllibEightDots(
						3,0,2,6,0,2,6,0,-2,2,0,-2,
						3,3,2,6,3,2,6,3,-2,2,3,-2);
}

static void desenhaTecla(double x, double y, double z)
{
    GLfloat cor[] = {1.0, 1.0, 1.0, 1.0};
    glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, cor);
//	glColor3f(1,1,1);
	gllibEightDots(
						x-0.5,y-0.5,z+0.25,x+0.5,y-0.5,z+0.25,x+0.5,y-0.5,z,x-0.5,y-0.5,z,
						x-0.5,y+0.5,z+0.25,x+0.5,y+0.5,z+0.25,x+0.5,y+0.5,z,x-0.5,y+0.5,z);
}

static void desenhaVisor(double x, double y, double z)
{
    GLfloat cor[] = {0.8, 1.0, 0.8, 1.0};
    glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, cor);
	glColor3f(0.8,1,0.8);
	gllibEightDots(
						x-2,y-2.5,z+0.1,x+2,y-2.5,z+0.1,x+2,y-2.5,z,x-2,y-2.5,z,
						x-2,y+2.5,z+0.1,x+2,y+2.5,z+0.1,x+2,y+2.5,z,x-2,y+2.5,z);
}

static void desenhaTelefone()
{
    GLfloat cor[] = {0.8, 0.4, 0.4, 1.0};
    glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, cor);
//	glColor3f(0.8,0.4,0.4);
	gllibEightDots(
						-2.85,0,1.9,2.85,0,1.9,1.9,0,-1.9,-1.9,0,-1.9,
						-2.85,18,1.9,2.85,18,1.9,1.9,16,-1.9,-1.9,16,-1.9);

	desenhaVisor(0,14.5,2);

	desenhaTecla(-2,10.5,2);
	desenhaTecla(2,10.5,2);
	desenhaTecla(-2,9,2);
	desenhaTecla(0,9,2);
	desenhaTecla(2,9,2);
	desenhaTecla(-2,7.5,2);
	desenhaTecla(0,7.5,2);
	desenhaTecla(2,7.5,2);
	desenhaTecla(-2,6,2);
	desenhaTecla(0,6,2);
	desenhaTecla(2,6,2);
	desenhaTecla(-2,4.5,2);
	desenhaTecla(0,4.5,2);
	desenhaTecla(2,4.5,2);
}

void TelefoneArthur::draw()
{
	desenhaBase();
	desenhaTelefone();
}
